<?php
namespace App\Libraries;

use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Log;

class GoBackRemember{
	
    const KEY = '_url_key_';

    public static function getBackUrl($key, $default = '')
    {
        $actions=explode('\\', Route::current()->getActionName());
        $func=explode('@', $actions[count($actions)-1]);
        $controllerName=$func[0];  //当前控制器
        $actionName=$func[1];   //当前方法

        $default = $default ? $default :  'javascript:void(0)';
        
        try {
            return isset($_COOKIE[$key]) && $_COOKIE[$key] ? $_COOKIE[$key] : $default;
        } catch (\Throwable $th) {
            //throw $th;
        }
        return $default;

    }
	
}

